<template>
  <div class="realState">
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item><a href="/">新房</a></el-breadcrumb-item>
      <el-breadcrumb-item>楼盘管理</el-breadcrumb-item>
    </el-breadcrumb>
    <el-tabs type="border-card" @tab-click="tabsClick" v-model="tabsName">
      <el-tab-pane label="上架中" name="1">
        <Navigation :dropDownMenuData="dropDownMenuDataData"></Navigation>
        <FloorTable
          :floorTable="floorTableTwo"
          :floorSale="floorSale"
        ></FloorTable>
      </el-tab-pane>
      <el-tab-pane label="未通过审核" name="2">
        <Navigation></Navigation>
        <FloorTable
          :floorTable="floorTables"
          :floorSale="floorSale"
        ></FloorTable>
      </el-tab-pane>
      <el-tab-pane label="已下架" name="3">
        <Navigation></Navigation>
        <FloorTable
          :floorTable="floorTableTwo"
          :floorSale="floorSale"
        ></FloorTable>
      </el-tab-pane>
      <el-tab-pane label="草稿箱" name="4">
        <!-- <Navigation></Navigation> -->
        <FloorDrafts
          :floorTable="floorTables"
          :floorSale="floorSale"
        ></FloorDrafts>
        <!-- <FloorTable
          :floorTable="floorTables"
          :floorSale="floorSale"
        ></FloorTable> -->
      </el-tab-pane>
      <el-tab-pane label="待分配楼盘" name="5">
        <Navigation></Navigation>
        <FloorTable
          :floorTable="floorTables"
          :floorSale="floorSale"
        ></FloorTable>
      </el-tab-pane>
      <el-tab-pane label="待审核楼盘" name="6">
        <Navigation></Navigation>
        <FloorTable
          :floorTable="floorTables"
          :floorSale="floorSale"
        ></FloorTable>
      </el-tab-pane>
    </el-tabs>
    <!-- <el-button @click="login">按钮</el-button> -->
  </div>
</template>

<script>
import Navigation from '../components/Navigation'
import FloorTable from '../components/FloorTable'
import FloorDrafts from '../components/FloorDrafts'
import * as api from '../utils/api'
import axios from 'axios'
export default {
  name: 'realState',
  data() {
    return {
      tabsData: '',
      tabsName: '1',
      // 装楼盘信息初始的数组
      floorTables: [],
      // 装整合后的楼盘信息的数组
      floorTableTwo: [],
      // 装下拉菜单数据
      dropDownMenuData: [],
      // 装整合后的下拉菜单数据
      dropDownMenuDataData: [],
      // 楼盘管理表格
      // floorTable: [
      //   {
      //     id: "1",
      //     floorId: "1123123213",
      //     floorName: "中洲中央城邦1",
      //     floorWeight: "5级",
      //     views: "333",
      //     dutyPeople: "张三",
      //     man: "李四",
      //     keyBorder: "王五",
      //     housingType: "商铺",
      //     region: "大源",
      //     residence: "住宅",
      //     residencePrice: "3000",
      //     shops: "商铺",
      //     shopsPrcie: "4000",
      //     officeBuilding: "写字楼",
      //     officeBuildingPrice: "6000",
      //   },
      //   {
      //     id: "2",
      //     floorId: "1123123213",
      //     floorName: "中洲中央城邦2",
      //     floorWeight: "5级",
      //     views: "333",
      //     dutyPeople: "张三",
      //     man: "李四",
      //     keyBorder: "王五",
      //     housingType: "商铺",
      //     region: "大源",
      //     residence: "住宅",
      //     residencePrice: "3000",
      //     shops: "商铺",
      //     shopsPrcie: "4000",
      //     officeBuilding: "写字楼",
      //     officeBuildingPrice: "6000",
      //   },
      //   {
      //     id: "3",
      //     floorId: "1123123213",
      //     floorName: "中洲中央城邦3",
      //     floorWeight: "5级",
      //     views: "333",
      //     dutyPeople: "张三",
      //     man: "李四",
      //     keyBorder: "王五",
      //     housingType: "商铺",
      //     region: "大源",
      //     residence: "住宅",
      //     residencePrice: "3000",
      //     shops: "商铺",
      //     shopsPrcie: "4000",
      //     officeBuilding: "写字楼",
      //     officeBuildingPrice: "6000",
      //   },
      //   {
      //     id: "4",
      //     floorId: "1123123213",
      //     floorName: "中洲中央城邦4",
      //     floorWeight: "5级",
      //     views: "333",
      //     dutyPeople: "张三",
      //     man: "李四",
      //     keyBorder: "王五",
      //     housingType: "商铺",
      //     region: "大源",
      //     residence: "住宅",
      //     residencePrice: "3000",
      //     shops: "商铺",
      //     shopsPrcie: "4000",
      //     officeBuilding: "写字楼",
      //     officeBuildingPrice: "6000",
      //   },
      //   {
      //     id: "5",
      //     floorId: "1123123213",
      //     floorName: "中洲中央城邦5",
      //     floorWeight: "5级",
      //     views: "333",
      //     dutyPeople: "张三",
      //     man: "李四",
      //     keyBorder: "王五",
      //     housingType: "商铺",
      //     region: "大源",
      //     residence: "住宅",
      //     residencePrice: "3000",
      //     shops: "商铺",
      //     shopsPrcie: "4000",
      //     officeBuilding: "写字楼",
      //     officeBuildingPrice: "6000",
      //   },
      // ],
      // 楼盘管理下拉框
      floorSale: [
        { id: '1', name: '编辑楼盘概要', path: './HouseAdmin' },
        { id: '2', name: '编辑参数', path: './HouseAdmin' },
        { id: '3', name: '户型', path: './HouseAdmin' },
        { id: '4', name: '价格', path: './HouseAdmin' },
        { id: '5', name: '相册', path: './HouseAdmin' },
        { id: '6', name: '开盘', path: './HouseAdmin' },
        { id: '7', name: '交房', path: './HouseAdmin' },
        { id: '8', name: '预售许可证', path: './HouseAdmin' },
        { id: '9', name: '楼栋/总平图', path: './HouseAdmin' },
        { id: '10', name: '操作日志', path: './HouseAdmin' },
      ],
    }
  },
  components: {
    Navigation,
    FloorTable,
    FloorDrafts,
  },
  methods: {
    tabsClick(tab, event) {
      for (let i = 0; i < this.floorTables.length; i++) {
        for (let j = i; j < this.floorTables[i].length; j++) {
          this.floorTableTwo.push(this.floorTables[i][j])
          console.log(this.floorTableTwo)
        }
      }
    },
    // mock模拟的数据
    login() {
      axios
        .get('/api/data')
        .then((res) => {
          this.data = res.data.data
          // console.log(res.data);
        })
        .catch((res) => {
          // alert("worang");
        })
    },
    // 查询楼盘信息接口
    floorInformation() {
      axios({
        // url: "/api/rema/queryInformation",
        url: '/api/rema/queryInformation',
        method: 'post',
        data: {},
      })
        .then((data) => {
          let floorBulidingData = data.data.data.dataList
          this.floorTables.push(floorBulidingData)
          console.log(this.floorTables)
        })
        .catch((err) => {
          console.log(err)
        })
    },
    // 查询下拉菜单数据
    dropDownMenuFun() {
      axios({
        url: '/api/rema/queryInformation',
        method: 'get',
      }).then((data) => {
        this.dropDownMenuData.push(data.data.data)
        for (let i = 0; i < this.dropDownMenuData.length; i++) {
          for (let j = 0; j < this.dropDownMenuData[i][j].length; j++) {
            console.log(123)
            this.dropDownMenuDataData.push(this.dropDownMenuData[i][j])
            console.log(this.dropDownMenuDataData)
          }
        }
      })
    },
  },
  created() {
    this.floorInformation()
    this.dropDownMenuFun()
  },
}
</script>

<style lang="less" scoped>
.el-tabs {
  background-color: white;
}
.demo-table-expand {
  font-size: 0;
}
.demo-table-expand label {
  width: 90px;
  color: #99a9bf;
}
.demo-table-expand .el-form-item {
  margin-right: 0;
  margin-bottom: 0;
  width: 50%;
}
</style>
